<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{margin:0;padding:0;}
        .box{
            width: 200px;
            height: 200px;
            position: relative;
            background-color: blue;
            margin:100px;
        } 
    </style>
</head>
<body>
        <div class="box"> </div>
        <script>
            var oDiv = document.querySelector(".box");
            var obj = oDiv.getBoundingClientRect();
            document.onmousemove = function(e){
                var e = e || window.event;
                if(e.clientX > obj.left && e.clientX < obj.right && e.clientY > obj.top && e.clientY < obj.bottom){
                    alert( " 输入移入了div ");
                }
            }
        </script>
</body>
</html>